package com.medicine.model;

import java.io.Serializable;
import java.util.List;

import javax.enterprise.inject.Model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the illness_category database table.
 * 
 */
@Entity
@Table(name="illness_category")
@NamedQuery(name="IllnessCategory.findAll", query="SELECT i FROM IllnessCategory i")
@Model
public class IllnessCategory implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int id;

	@Column(name="illness_name")
	private String illnessName;

	//bi-directional many-to-one association to SubCategory
	@OneToMany(mappedBy="illnessCategory")
	private List<SubCategory> subCategories;

	public IllnessCategory() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getIllnessName() {
		return this.illnessName;
	}

	public void setIllnessName(String illnessName) {
		this.illnessName = illnessName;
	}

	public List<SubCategory> getSubCategories() {
		return this.subCategories;
	}

	public void setSubCategories(List<SubCategory> subCategories) {
		this.subCategories = subCategories;
	}

	public SubCategory addSubCategory(SubCategory subCategory) {
		getSubCategories().add(subCategory);
		subCategory.setIllnessCategory(this);

		return subCategory;
	}

	public SubCategory removeSubCategory(SubCategory subCategory) {
		getSubCategories().remove(subCategory);
		subCategory.setIllnessCategory(null);

		return subCategory;
	}

}